package com.cqgc.dao;

import com.cqgc.domain.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fengzongfu
 */
public interface BookDao {

    //新增
    @Insert("insert into tbl_book values(null,#{type},#{name},#{description})")
    void save(Book book);

    //删除
    @Delete("delete from tbl_book where id=#{id}")
    void delete(Integer id);

    //修改
    void update(Book book);

    //查询所有书
    @Select("select * from tbl_book")
    List<Book> getAll();


    //查询一本书
    @Select("select * from tbl_book where id = #{id}")
    Book getById(Integer id);
}
